#!/bin/bash
IMAGE_NAME=$1

sub=$(uuidgen | cut -c1-8)
# -------兼容修改yml文件----------
docker pull ${IMAGE_NAME}
docker run --rm  --name "check_version_${sub}" \
    -u root \
    --privileged=true \
    --entrypoint=bash \
    --net=host \
    -w /data/CI/scripts \
    -v /data/CI/scripts:/data/CI/scripts \
    -v /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro \
    ${IMAGE_NAME} -c "source ~/.bashrc && echo y | cd /workspace/omniinfer &&  "

compation_res=$?
if [ $compation_res == "0" ]; then    # 0.4.0版本
    echo "run 0.4.0 change file, skip 5P1D case"
    exit 0
# elif [ $compation_res == "1" ]; then  # 0.5.0版本
#     echo "run 0.5.0 change file"
#     echo 'sed -i "s#adaptors/vllm/patches/profiler_patches/proc_bind/proc_marker_namelist.yml#tools/profiler/proc_bind/proc_marker_namelist.yml#g" $play_book_path'
#     sed -i "s#adaptors/vllm/patches/profiler_patches/proc_bind/proc_marker_namelist.yml#tools/profiler/proc_bind/proc_marker_namelist.yml#g" $play_book_path
# else
#     echo "未找到目标文件，不进行修改"
fi
# -------兼容修改结束------------